<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<style>
/*
input[type="radio"] {
  margin: 3px 3px 0px 5px;
  display: none;
}
*/
label {
  padding-left: 20px;
  cursor: pointer;
  background: url(bg.gif) no-repeat left top;
}
label.checked {
  background-position: left bottom;
  background: #0ff ;
}

#form .row img { max-height:200px; margin:20px;}
#form .row .img { -webkit-filter: grayscale(100%); /* Chrome, Safari, Opera */ filter: grayscale(100%);}
#form .row span {   position: relative; left: 0px; top: -1rem; }
#form .row span {   background-color: #818a91;     display: inline-block;
    padding: .25em .4em;
    font-size: 75%;
    line-height: 1;
    color: #fff;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25rem;
    font-weight: 700;
    }
#form .row span input { position: relative; left: 0px; top: 0.15rem; }
</style>

<div class="row">
	<div class="col-lg-10 offset-lg-1">
		<div class="card">
			<div class="card-block">
				<form action="<?php echo url("plugin-setting-z_top");?>" method="post" id="form">
					<h4 class="card-title">萌化返回顶部插件</h4>
					<div class="form-group row">
					  <?php 
					  $dir = "../plugin/z_top/list/";
            $file = scandir($dir);
            //这个数组好tm微妙啊...
            for ($x=2; $x<count($file); $x++) {
            if ($x-1 == $setting['body_start'] ) {$checked = 'checked="checked"'; $nok = ''; $txt='&nbsp;&nbsp;已激活';}else {$checked = ''; $nok='class="img"';$txt='';}
            echo '<label class="c-input c-radio">';
            echo '<img src="'.$dir.$file[$x].'/img.png" '.$nok.'><br>';
            echo '<span>'.$file[$x].$txt.' ';
            echo '<input type="radio" name="body_start" value="'.$file[$x].'" '.$checked.' /></span></label>';
            } 

					  ?>
         
						<div class="col-sm-10">

						</div>
					</div>

					<div class="form-group row">
						<label class="col-sm-2 form-control-label"></label>
						<div class="col-sm-10">
							<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>..."><?php echo lang('confirm');?></button>
							<a role="button" class="btn btn-secondary btn-block m-t-1" href="javascript:history.back();"><?php echo lang('back');?></a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>

var jform = $("#form");
var jsubmit = $("#submit");
var referer = '<?php echo http_referer();?>';
jform.on('submit', function(){
	jform.reset();
	jsubmit.button('loading');
	var postdata = jform.serialize();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.text(message).delay(2000).button('reset').location(referer);
			return;
		} else {
			$.alert(message);
			jsubmit.button('reset');
		}
	});
	return false;
});

</script>